import request from '@/utils/request'


// 查询训练任务列表
export function listTraining(query) {
  return request({
    url: '/trainings',
    method: 'get',
    params: query
  })
}

// 查询训练任务详细
export function getTraining(trainingId) {
  return request({
    url: '/trainings/' + trainingId,
    method: 'get'
  })
}

// 新增训练任务
export function addTraining(data) {
  return request({
    url: '/trainings',  
    method: 'post',
    data: data
  })
}

// 修改训练任务 
export function updateTraining(data) {
  return request({
    url: '/trainings',
    method: 'put',
    data: data
  })
}

// 删除训练任务
export function delTraining(trainingId) {
  return request({
    url: '/trainings/' + trainingId,
    method: 'delete'
  })
}

// 启动训练任务
export function startTraining(trainingId) {
  return request({
    url: '/trainings/start/' + trainingId,
    method: 'get'
  })
}

// 暂停训练任务
export function stopTraining(trainingId) {
  return request({
    url: '/trainings/stop/' + trainingId,
    method: 'get'
  })
}
